{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!--BOOK_INFORMATION-->\n",
    "<img align=\"left\" style=\"padding-right:10px;\" src=\"figures/PHydro-cover-small.png\">\n",
    "*This is the Jupyter notebook version of the [Python in Hydrology](http://www.greenteapress.com/pythonhydro/pythonhydro.html) by Sat Kumar Tomer.*\n",
    "*Source code is available at [code.google.com](https://code.google.com/archive/p/python-in-hydrology/source).*\n",
    "\n",
    "*The book is available under the [GNU Free Documentation License](http://www.gnu.org/copyleft/fdl.html). If you have comments, corrections or suggestions, please send email to satkumartomer@gmail.com.*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!--NAVIGATION-->\n",
    "< [Preface](00.00-Preface.ipynb) | [Contents](Index.ipynb) | [Why Python?](01.01-Why-Python.ipynb) >"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.5 执行程序\n",
    "Python是一种由解释器执行程序的解释型语言。有两种使用解释器的方式：交互模式和脚本模式。在交互模式下，你可以输入Python程序(在调用Python之后，即在终端或命令窗口输入python完成)，解释器输出结果，以1+1为例：\n",
    "\n",
    "```\n",
    ">>> 1 + 1\n",
    "```\n",
    "\n",
    "`>>>`是解释器用来表示它已经准备好了的提示。如果输入`1 + 1`，解释器将回复2。或者，你也可以将代码保存在一个文件中，并使用解释器执行文件中的内容，该文件被称为脚本。按照惯例，Python脚本的名称以.py结尾。假设你已经将脚本命名为myscript.py,并且想要在Unix/Linux shell中执行脚本，你应该这样做：\n",
    "\n",
    "```\n",
    "$ python myscript.py\n",
    "```\n",
    "\n",
    "或者，你可以为你的脚本授予可执行权限，并且只需运行该脚本。语法如下：\n",
    "```\n",
    "$ chmod +x myscript.py\n",
    "$ ./myscript.py\n",
    "```\n",
    "在IDE中，执行脚本的细节各不相同。你可以在Python网站python.org中找到有关你的环境的说明。以交互式模式工作可以方便的测试小块代码，因为你能够很快的输入并执行它们。但是对于任何不止几行代码的内容，你应该将代码保存为脚本，以便在将来修改和执行。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
